<template>
	<view>
		<u-popup :show="regOpen" mode="bottom" @close="closeModel" @open="open" bgColor="#1a2038">
			<view class="login_box">
				   <view>
					   <u--text text="Sign in" color="#f1c594"></u--text>
					   <view style="margin-top: 14rpx;margin-bottom: 46rpx;">
						   <u--text text="首次登录需要填写邀请码" color="#556185" size="12"></u--text>
					   </view>
					   
				   </view>
				   <view>
					   <view style="margin-bottom: 16rpx;">
						   <u--text text="邀请码CODE" align="center" color="#f1c594"  size="14"></u--text>
					   </view>
					   <u--input
					       placeholder="请使用邀请码链接"
					       border="none"
					       v-model="shareCode"
						   color="#fff"
						   inputAlign="center"
						   fontSize="14"
						   style="background:#556185;border-radius:40rpx;padding: 10rpx 20rpx;height: 70rpx;margin-bottom: 40rpx;"
					     ></u--input>
				   </view>
				   <view>
					   <view style="margin-bottom: 16rpx;">
						   <u--text text="支付密码" align="center" color="#f1c594" style="margin-bottom: 16rpx;" size="14"></u--text>
						   </view>
				   					   
				   					   <u--input
				   					       placeholder="请输入支付密码"
				   					       border="none"
				   					       v-model="paypassword"
				   					   
				   						   color="#fff"
				   						   inputAlign="center"
				   						   fontSize="14"
				   						   style="background:#556185;border-radius:40rpx;padding: 10rpx 20rpx;height: 70rpx;margin-bottom: 40rpx;"
				   					     ></u--input>
				   </view>
				   <view>
					   <view style="margin-bottom: 16rpx;">
						     <u--text text="确认支付密码" align="center" color="#f1c594" style="margin-bottom: 16rpx;" size="14"></u--text>
					   						   </view>
				   					 
				   					   <u--input
				   					       placeholder="请输入确定支付密码"
				   					       border="none"
				   					       v-model="comPaypassword"
				   					
				   						   color="#fff"
				   						   inputAlign="center"
				   						   fontSize="14"
				   						   style="background:#556185;border-radius:40rpx;padding: 10rpx 20rpx;height: 70rpx;margin-bottom: 40rpx;"
				   					     ></u--input>
				   </view>
				   <u-button text="注册" class="btn-common" style="margin-bottom: 40rpx;" @click="buttonReg()"></u-button>
			</view>
		</u-popup>
		
	</view>

</template>

<script>
	
	import yui from '@/common/httpRequest';
	import web3 from '@/common/web3Rpc.js';
	export default {
		name: 'regPop',
		props: {
			//是否固定
			regOpen: {
				type: Boolean,
				default: false
			},
		},
		data() {
			return {
				paypassword:'',
				comPaypassword:'',
				indexs: 0,
				select_btn: true,

				isloading: false,
				types: 1,
	
				current: 0,
				shareCode:'',
				address:'',

			};
		},
		mounted() {
			this.shareCode = this.tui.getUserReferee();
		},
		methods: {
			closeModel() {
				this.$emit('close');
				this.regModelOpen = false;
			},
            
			// buttonReg(){
			// 	this.tui.setUserNodeData(this.nodeCode)
			// 	this.$emit('connectWallet');
			// }
			buttonReg(){
				// if(this.paypassword!=this.comPaypassword){
				// 	this.$emit('showTips','二次密码输入不一致');
				// 	// return
				// }
				this.address=uni.getStorageSync("yy_wallet").address
				let datas={paypassword:this.paypassword,codes:this.shareCode,authorization_code:this.address}
				
				let nodeData = this.tui.request('/api/login/authAddress', 'post', datas, 1000, 1, '', 'authAddress');
				Promise.resolve(nodeData).then((value) => {
					if (value.code == 200) {
						console.log(value)
						yui.setToken(value.data.token)
						// location.reload();
					}else{
						// this.isfalse=true
						this.$emit('showTips',value.message);
					}
				})
			},
			
			

		}
	};
</script>

<style lang="scss">
	.login_box{
		padding:30rpx;
	}
</style>